﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading;

namespace WebApplication1.TestJs
{
    /// <summary>
    /// JsonPHandler 的摘要说明
    /// </summary>
    public class JsonPHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string callback = context.Request["callbackparam"]??"";
            string id = context.Request["id"]??"";
            string rst = "";
            if (!callback.Equals(""))
            {
                context.Response.ContentType = "application/javascript"; //jsonp //"text/plain";
                string callbackFunName = context.Request["callbackparam"];
                rst = callbackFunName + "([{\"name\":\"李世杰" + id + "\"}])";
            }
            else
            {
                context.Response.ContentType = "text/plain";
                rst ="李世杰" + id;
            }
            context.Response.Write(rst);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}